﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Gammar.Digger.SystemFramework.Web
{
    public class UrlHelper
    {
        /// <summary>
        /// 网站根目录(虚拟)
        /// </summary>
        public static readonly string RootVirtualPath = HttpRuntime.AppDomainAppVirtualPath;

        /// <summary>
        /// 网站根目录(物理)
        /// </summary>
        public static readonly string RootPhysicalPath = HttpRuntime.AppDomainAppPath;

        /// <summary>
        /// 返回上一个页面的地址
        /// </summary>
        /// <returns>上一个页面的地址</returns>
        public static string GetUrlReferrer()
        {
            string retVal = null;

            try
            {
                retVal = HttpContext.Current.Request.UrlReferrer.ToString();
            }
            catch { }

            if (retVal == null)
                return "";

            return retVal;

        }

        /// <summary>
        /// 配置文件虚拟目录
        /// </summary>
        public static readonly string ConfigVirtualPath = RootVirtualPath + "/Common/Config/";

        /// <summary>
        /// 配置文件物理路径 
        /// </summary>
        public static readonly string ConfigPhisicalPath = RootPhysicalPath + @"Common\Config\";

        /// <summary>
        /// 图片虚拟目录
        /// </summary>
        public static readonly string ImagesVirtualPath = RootVirtualPath + "/Common/Images/";

        /// <summary>
        /// 图片物理路径 
        /// </summary>
        public static readonly string ImagesPhisicalPath = RootPhysicalPath + @"Common\Images\";

        /// <summary>
        /// javascript虚拟目录
        /// </summary>
        public static readonly string JSVirtualPath = RootVirtualPath + "/Common/Javascript/";

        /// <summary>
        /// javascript物理路径 
        /// </summary>
        public static readonly string JSPhisicalPath = RootPhysicalPath + @"Common\Javascript\";

        /// <summary>
        /// 上传文件虚拟目录
        /// </summary>
        public static readonly string UploadVirtualPath = RootVirtualPath + "/Common/Upload/";

        /// <summary>
        /// 上传文件物理路径 
        /// </summary>
        public static readonly string UploadPhisicalPath = RootPhysicalPath + @"Common\Upload\";

        /// <summary>
        /// 用户控件虚拟目录
        /// </summary>
        public static readonly string UCVirtualPath = RootVirtualPath + "/Common/UserControls/";

        /// <summary>
        /// 用户控件物理路径 
        /// </summary>
        public static readonly string UCPhisicalPath = RootPhysicalPath + @"Common\UserControls\";
    
    }
}
